package com.example.administrator.testproject.video;

import android.content.res.Configuration;
import android.os.Bundle;
import android.os.Environment;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;

import com.example.administrator.testproject.R;

import java.io.File;

import fm.jiecao.jcvideoplayer_lib.JCVideoPlayer;
import fm.jiecao.jcvideoplayer_lib.JCVideoPlayerStandard;

import static com.example.administrator.testproject.R.id.videoPlayer;

public class VideoActivity extends AppCompatActivity {

    private JCVideoPlayerStandard player;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_video);
        player = (JCVideoPlayerStandard) findViewById(videoPlayer);
        Log.e("Tag", 0x01 + "----" + 0x02 + "----" + 0x03);
//        String uri = Environment.getExternalStorageDirectory().getPath() + "/ceshi2.MP4";
        String uri = Environment.getExternalStorageDirectory().getPath() +
                File.separator + "m3u8temp"+File.separator+"test.m3u8";
        player.setUp(uri, JCVideoPlayer.SCREEN_LAYOUT_NORMAL, "xxxx");

    }

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
//切换为竖屏
        if (newConfig.orientation == this.getResources().getConfiguration().ORIENTATION_PORTRAIT) {
//            player.set
        }
//切换为横屏
        else if (newConfig.orientation == this.getResources().getConfiguration().ORIENTATION_LANDSCAPE) {
            player.startWindowFullscreen();
        }
    }
}
